source_file=$1
dest_file=$2
column=$3

sort -k$column $source_file | awk '{if($2 == MID) {} if($2 != MID) {MID = $2; print $0;}}' a=$column >$dest_file